{extend name="index/index" /}
{block name="index"}
<div class="tpl-content-wrapper">
    <div class="tpl-content-page-title">
        {empty name="data"}
        未知
        {else /}
        用户{$data.0.name}列表
        {/empty}
    </div>
    <ol class="am-breadcrumb">
        <li><a href="{:url('admin/index/index')}" class="am-icon-home">首页</a></li>
        <!-- <li><a href="#">Amaze UI CSS</a></li> -->
        <li class="am-active">管理员列表</li>
    </ol>
    <div class="tpl-portlet-components">
        <div class="portlet-title">
            <div class="caption font-green bold">
                <span class="am-icon-code"></span>
            </div>
            <div class="tpl-portlet-input tpl-fz-ml">
                <div class="portlet-input input-small input-inline">
                </div>
            </div>


        </div>
        <div class="tpl-block">
            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-6">
                    <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-xs">
                        </div>
                    </div>
                </div>
                <div class="am-u-sm-12 am-u-md-3">

                </div>
                <div class="am-u-sm-12 am-u-md-3">
                    <div class="am-input-group am-input-group-sm">
                        <form action="{:url('admin/Centent/find')}">
                            <input type="text" name="title" class="am-form-field" style="width: 185px">
                            <span class="am-input-group-btn">
                                <button class="am-btn  am-btn-default am-btn-success tpl-am-btn-success am-icon-search" type="submit"></button>
                            </span>
                        </form>
                    </div>
                </div>
            </div>
            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main">
                            <thead>
                            <tr>
                                <th width="20%">图片ID</th>
                                <th width="20%">状态</th>
                                <th width="20%">图片名</th>
                                <th width="20%">图片</th>
                                <th width="20%">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="data" id="v"}
                            <tr>

                                <td>{$v.id}</td>
                                {if condition="$v.status eq 1"}
                                <td><font color="red" size="2"><strong>待审核</strong></font></td>
                                {else /}
                                    {if condition="$v.status eq 2"}
                                    <td><font color="green" size="2"><strong>审核已通过</strong></font></td>
                                    {else /}
                                    <td><font color="red" size="2"><strong>审核未通过</strong></font></td>
                                    {/if}
                                {/if}
                                <td>{$v.title}</td>
                                <td><img src="http://pn5tyoo5a.bkt.clouddn.com/{$v.src}" width="100"></td>
                                <td>
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-toolbar">
                                            <div class="am-btn-group am-btn-group-xs">
                                                {if condition="$v.status eq 1"}

                                                    <a href="javascript:void(0)" class="am-btn am-btn-default am-btn-xs am-text-secondary" style="background: white;color:skyblue" onclick="pass(this,{$v['id']})"><span class="am-icon-pencil-square-o"></span>

                                                        <span class="am-icon-copy" style="color:green">通过</span>
                                                    </a>
                                                {else /}
                                                    {if condition="$v.status eq 3"}
                                                    
                                                    <a href="javascript:void(0)" class="am-btn am-btn-default am-btn-xs am-text-secondary" style="background: white;color:skyblue" onclick="pass(this,{$v['id']})"><span class="am-icon-pencil-square-o"></span>

                                                        <span class="am-icon-copy" style="color:green">通过</span>
                                                    </a>
                                                    {else /}

                                                    <a href="javascript:void(0)" class="am-btn am-btn-default am-btn-xs am-text-secondary" style="background: white;color:skyblue" onclick="onpass(this,{$v['id']})"><span class="am-icon-pencil-square-o"></span>

                                                        <span class="am-icon-copy" style="color:red">不通过</span>
                                                    </a>
                                                    {/if}

                                                {/if}
                                            </div>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        
                        <hr>

                    </form>
                </div>

            </div>
        </div>
        <div class="tpl-alert"></div>
    </div>

</div>
    <script src="/static/admin/assets/js/jquery-1.8.3.min.js"></script>
    <script>
            function pass(obj,id){

                $.ajax({
                    url:"/examine_pass",
                    Type:'get',
                    data:{id:id},
                    dataType:'json',
                    success:function(data){

                      if (data.status) {
                        
                          toastr.success(data.msg);
                          window.location.reload();

                      } else {
                          toastr.error(data.msg);
                      }

                    },
                    error:function(data){
                        toastr.error('系统故障,请联系管理员');
                    }
                });


            }

            function onpass(obj,id){

                $.ajax({
                    url:"/examine_nopass",
                    Type:'get',
                    data:{id:id},
                    dataType:'json',
                    success:function(data){

                      if (data.status) {
                          // modal1.style.display = "none";
                          toastr.success(data.msg);
                          window.location.reload();

                      } else {
                          toastr.error(data.msg);
                      }

                    },
                    error:function(data){
                        toastr.error('系统故障,请联系管理员');
                    }
                });


            }

    </script>

{/block}
